// D3D9BufferManager.cpp

#include "stdafx.h"

#include "D3D9IndexBuffer.h"
#include "D3D9VertexBuffer.h"

#include "D3D9BufferManager.h"

CD3D9BufferManager::CD3D9BufferManager(IDirect3DDevice9* pDevice) : 
m_pDevice(pDevice)
{

}

CD3D9BufferManager::~CD3D9BufferManager()
{
	m_pDevice = NULL;
}

CD3D9VertexBuffer* CD3D9BufferManager::CreateVertexBuffer(size_t vertexSize, size_t numVertices, DWORD dwUsage)
{
	CD3D9VertexBuffer* pvb = new CD3D9VertexBuffer(vertexSize, numVertices, dwUsage, m_pDevice);
	m_VertexBuffers.insert(pvb);
	return pvb;
}

CD3D9IndexBuffer* CD3D9BufferManager::CreateIndexBuffer(D3DFORMAT indexType, size_t numIndices, DWORD dwUsage)
{
	CD3D9IndexBuffer* pib = new CD3D9IndexBuffer(indexType, numIndices, dwUsage, m_pDevice);
	m_IndexBuffers.insert(pib);
	return pib;
}